<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
@html_name: 01对象扩展
@description: The past cannot be redeemed, the future can be changed.
@author: Jason Black
@create: 2023/6/27 19:16:20
-->
<script type="text/javascript">
    /**
     * Rest参数与spread扩展运算符在ES6中已经引入，不过ES6中只针对于数组，
     * 在ES9中为对象提供了像数组一样的rest参数和扩展运算符
     */
    function methodTest01({url, datasource, ...user}) {
        console.log(url)
        console.log(datasource)
        console.log(user)
    }

    methodTest01({
        url: "www.jason/black.com",
        datasource: "Jason",
        username: "Jason",
        password: "Jason"
    })

    // 对象合并
    const o1 = {
        name01: 'Jason'
    }
    const o2 = {
        name02: 'Black'
    }
    const o3 = {
        name03: 'Jackson'
    }
    const o4 = {
        name04: 'Jack'
    }
    const OBJECT = {...o1,...o2,...o3,...o4}
    console.log(OBJECT)

</script>
</body>
</html>